<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="/css/editthings.css" />
	<script src="/js/admin/jquery/jquery-1.6.1.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="/js/ckeditor/ckeditor.js" language="javascript" ></script>
	<link rel="stylesheet" type="text/css" href="/js/admin/jquery/ui/themes/ui-lightness/jquery.ui.all.css" />
	<script src="/js/admin/jquery/ui/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
	<script src="/js/admin/jquery/ui/external/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
	<script src="/js/admin/jquery/tabs.js" type="text/javascript"></script>
	<script src="/js/admin/jquery/superfish/js/superfish.js" type="text/javascript"></script>
</head>
<body>
<?php if(!isset($this->error_login)){?>
				<?php if(isset($this->error_process)&&($this->error_process == 1)){?>
					<script type="text/javascript">
						  window.opener.location.href = window.opener.location.href;
						  if (window.opener.progressWindow)
						  {
						    window.opener.progressWindow.close();
						  }
						  window.close();
					</script>
				<?php } else {?>
				<form method="post" action="/news/post?action=insert<?php if(isset($this->news)){ echo "&path=".$this->news;}?>" name="form_edit_news" id="form_edit_news">
					
					<div class="content_btn" style="float: right">
						<div class="submit">
							<input type="submit" value="<?php echo$this->textbutton;?>" name="submit" class="edit_submit"/>
						</div>
					</div>
					<div><p><?php echo $this->textTitle;?></p></div>
					<div style="clear: both;"></div>
					<div class="line"></div>
					<?php if(isset($this->error_process)&&($this->error_process == -1)){?><h4 style="color:red"><?php echo $this->textError1;?></h4><?php }?>			
					<div class="content_row">
						<div class="content_row_l">
							<p><?php Echo $this->texttieude;?> Default <input type="text" value="<?php echo $this->title['Default'];?>" size="30" maxlength="30" name="news_title[Default]" id="news_title_Default" class="content_input"/></p>
							<?php if(isset($this->error_title['Default'])){?><h4 style="color:red;margin-top: -15px;height: 10px;"><?php Echo $this->textError2;?></h4><?php }?>
						</div>
					</div>
					<?php foreach($this->languages as $lang){?>
					<div class="content_row">
						<div class="content_row_l">
							<p><?php Echo $this->texttieude;?> <?php echo $lang['name'];?> <input type="text" value="<?php echo $this->title[$lang['name']];?>" size="30" maxlength="30" name="news_title[<?php echo $lang['name'];?>]" id="news_title_<?php echo $lang['name'];?>" class="content_input"/></p>
							<?php if(isset($this->error_title[$lang['name']])){?><h4 style="color:red;margin-top: -15px;height: 10px;"><?php Echo $this->textError2;?></h4><?php }?>
						</div>
					</div>
					<?php }?>
					<div style="clear:both;"></div>
					<?php if(isset($this->cate)&&($this->cate!="")&&($this->cate!=0)&&($this->cate!=null)){?>
							<input name = "news_category" id = "news_category" value = "<?php echo $this->cate; ?>" type = "hidden" />
							<?php }else{?>
					<div class="content_row">
						<div class="content_row_l">
							<p><?php Echo $this->textDM;?>
							<select tabindex="0" name="news_category" id="news_category">
								<?php foreach ($this->Categoriesnews as $category){?>
								<option <?php if(($this->category!=0)&&($this->category == $category["category_id"])){?>selected="selected"<?php } ?> value="<?php echo $category["category_id"];?>"><?php $temp = unserialize($category["category_name"]); echo $temp[$this->nameLang];?></option>
								<?php } ?>
							 </select></p>
							 <?php if(isset($this->error_category)){?><h4 style="color:red;margin-top: -15px;height: 10px;"><?php Echo $this->textDMO;?></h4><?php }?>
						</div>
					</div>
					<?php }?>
						<div class="content_row">
							<div class="content_row_l"><p><?php Echo $this->textava;?></p></div>
							<div class="content_row_r" id="content">
								<img src="/images/noimage.jpg" id="image_url" class="image" style ="width:150px;height:150px;" onclick="image_upload('news_avatar', 'image_url','1');" />
					    		<input type="hidden" name="news_avatar" value="/images/noimage.jpg" id="news_avatar" />
							</div>
						</div>
					<div class="content_row">
						<div class="content_row_l"><p><?php Echo $this->textND;?> Default</p></div>
						<?php if($this->error_shortdes['Default']){?><h4 style="color:red;margin-top: -15px;height: 10px;"><?php Echo $this->textError4;?></h4><?php }?>
						<div class="content_row_r">
							<textarea name="news_short_description[Default]" style="width:500px" ><?php echo $this->short_des['Default'];?></textarea>
						</div>
					</div>
					<?php foreach ($this->languages as $lang){?>
					<div class="content_row">
						<div class="content_row_l"><p><?php Echo $this->textND;?> <?php echo $lang['name'];?></p></div>
						<?php if($this->error_shortdes[$lang['name']]){?><h4 style="color:red;margin-top: -15px;height: 10px;"><?php Echo $this->textError4;?></h4><?php }?>
						<div class="content_row_r">
							<textarea name="news_short_description[<?php echo $lang['name'];?>]" style="width:500px" ><?php echo $this->short_des[$lang['name']];?></textarea>
						</div>
					</div>
					<?php }?>
				</form>
				<script type="text/javascript"><!--
					function image_upload(field, preview, id) {
						$('#dialog').remove();
						
						$('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="/admin/filemanager?field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
						
						$('#dialog').dialog({
							title: 'Images Manager',
							close: function (event, ui) {
								if ($('#' + field).attr('value')) {
									$('#' + preview).replaceWith('<img src="' +$('#' + field).attr('value') + '" alt="" id="' + preview + '" class="image" style="width:80px;height:80px" onclick="image_upload(\'' + field + '\', \'' + preview + '\', \'' + id + '\');" />');

								}
							},	
							bgiframe: false,
							width: 700,
							height: 400,
							resizable: false,
							modal: false
						});
					};
				//--></script>
				<?php }?>
				<?php } else {  echo $this->textError6;}?>
</body>		
</html>		